import request from '@/utils/request'
import type { ResultModel } from './model/model'

// 分页条件查询
export const queryPageApi = (
  begin: string,
  end: string,
  name: string,
  page: number,
  pageSize: number,
) =>
  request.get<any, ResultModel>(
    `/clazzs?begin=${begin}&end=${end}&name=${name}&page=${page}&pageSize=${pageSize}`,
  )

// 新增班级
export const addApi = (clazz: any) => request.post<any, ResultModel>('/clazzs', clazz)

// 根据ID查询班级
export const queryInfoApi = (id: number) => request.get<any, ResultModel>(`/clazzs/${id}`)

// 更新班级
export const updateApi = (clazz: any) => request.put<any, ResultModel>(`/clazzs`, clazz)

// 批量删除班级
export const deleteApi = (id: number[]) =>
  request.delete<any, ResultModel>('/clazzs', { params: { id: id.join(',') } })

// 查询全部班级信息
export const queryAllApi = () => request.get<any, ResultModel>('/clazzs/list')
